<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        "use strict"//开启严格模式
        var stu={
            id:1,
            name:"小爱",
            age:24,
            hi:function(){
                console.log("hello")
            }
        }
        //修改
        Object.defineProperty(stu,'id',{
            writable:false,//设置值为不能修改
            enumerable:false
        });


        for(let t in stu){
            console.log(t);
        }

        console.log(stu);
        stu.id=2;
        console.log(stu);

        // var p1=Object.getOwnPropertyDescriptor(stu,'id');
        // console.log(p1);

    </script>
</body>
</html>